package written.test;

import java.util.*;

/**
 * @Author: Dang Qi
 * @Date: 2021/3/27  19:32
 * @Description:
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = sc.nextInt();
        }
        int target = sc.nextInt();
        System.out.println(solve(arr, target));
    }
    public static int solve(int[] arr, int target){
        int ans = 0;
        for(int i = 0; i< arr.length;i++){
            int t = 0;
            for(int j = i; j<arr.length; j++){
                t |= arr[j];
                if(t > target) break;
                ans++;
            }
        }
        return ans;
    }
}
